/**
 * This class has all the characteristics of Items
 * @author Sravya
 *
 */
public class Item {

        // Will add more types, weights, and prices later. The weights and prices correspond to the type of the same index.
        private final String TYPES[] = {"Gas", "Food", "Clothes", "Ammunition", "Spare Wheels", "Spare Axles", "Spare Engine"};
        private final double WEIGHTS[] = {2.5, 58, 279, 232, 132, 5, 27};
        private final double PRICES[] = {80, .2, 10, 10, 20, 20, 20};

        private String type = new String();
        private double weight = 0.0;
        private double price = 0.0;
        private int quantity = 0;
        /**
         * This is the constructor for Item
         * @param type		type of the item
         * @param quantity	quantity of the item
         */
        public Item(String type, int quantity) {
                this.type = type;
                this.quantity = quantity;

                int typeIndex = 0;
                for (int i = 0; i < TYPES.length; i++) {
                        if (TYPES[i].equalsIgnoreCase(type)) {
                                typeIndex = i;
                        }
                }

                weight = WEIGHTS[typeIndex];
                price = PRICES[typeIndex];
        }
        /**
         * This method is a getter for the type
         * @return type		type is the type of the Item
         */
        public String getType() {
                return type;
        }
        /**
         * This method is getter for the weight
         * @return weight	weight of the item
         */
        public double getWeight() {
                return weight;
        }
        /**
         * This method is getter for the price
         * @return price	price of the item
         */
        public double getPrice() {
                return price;
        }
        /**
         * This method is setter for the price
         * @param price		price of the item
         */
        public void setPrice(double price) {
                this.price = price;
        }
        /**
         * This method is getter for the quantity
         * @return quantity		quantity of the item
         */
        public int getQuantity() {
                return quantity;
        }
        /**
         * This method is setter for the quantity
         * @param quantity		quantity of the item
         */
        public void setQuantity(int quantity) {
                this.quantity = quantity;
        }

        public void addQuantity(int quantityToAdd) {
        	this.quantity = this.quantity + quantityToAdd;
        }
        
        public void subtractQuantity(int quantityToSubtract) {
        	this.quantity = this.quantity - quantityToSubtract;
        }
        
        /**
         * This method increments the quantity
         * @return quantity		quantity of the item
         */
        public int incrementQuantity() {
                quantity++;
                return quantity;
        }
        /**
         * This method decremetns the quantity
         * @return quantity		quantity of the item
         */
        public int decrementQuantity() {
                quantity--;
                return quantity;
        }
}